package cate.game.role.farm.adventure.task.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBAdventure;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "领取单个任务奖励 の 请求")
@OperationSetter(GDOperation.ADVENTURE_TASK_SIGNLE_REWARD)
public class GetSingleRewardReq implements MsgInput {
    @NoteField("任务唯一id")
    public String taskUid;

    @NoteField("领取类型,0为正常领取，1为消耗碎钻加速")
    public int type;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getFarm().adventure.task.getTaskReward(taskUid, type);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBAdventure.GET_SINGLE_REWARD_REQ;
    }
}
